﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_HienThiChucNang : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CboPhanHe")]
        private ComboBox _CboPhanHe;
        [AccessedThroughProperty("CKHienThiEngLish")]
        private CheckBox _CKHienThiEngLish;
        [AccessedThroughProperty("CKHienThiPhanHe")]
        private CheckBox _CKHienThiPhanHe;
        [AccessedThroughProperty("CmdCopy")]
        private Button _CmdCopy;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("VsList")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VsList;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;
        private clsMenu objMN;

        public Frm_HienThiChucNang()
        {
            base.Load += new EventHandler(this.Frm_HienThiChucNang_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.objMN = new clsMenu();
            this.InitializeComponent();
        }

        private void CboPhanHe_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboPhanHe.SelectedValue), "", modGeneral.TypeOfValue.String).ToString().Trim() != "")
            {
                this.LoadData(Conversions.ToString(this.CboPhanHe.SelectedValue));
            }
        }

        private void CKHienThiEngLish_CheckedChanged(object sender, EventArgs e)
        {
            this.VsList.Cols[2].Visible = this.CKHienThiEngLish.Checked;
        }

        private void CmdCopy_Click(object sender, EventArgs e)
        {
            if ((this.VsList.Rows.Count != 1) && (this.VsList.Row > 0))
            {
                int row = this.VsList.Row;
                this.VsList.AddItem("");
                C1.Win.C1FlexGrid.C1FlexGrid vsList = this.VsList;
                vsList[vsList.Rows.Count - 1, 0] = "";
                int num3 = this.VsList.Cols.Count - 1;
                for (int i = 1; i <= num3; i++)
                {
                    vsList[vsList.Rows.Count - 1, i] = RuntimeHelpers.GetObjectValue(vsList[row, i]);
                }
                vsList = null;
            }
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Frm_HienThiChucNang_Load(object sender, EventArgs e)
        {
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                this.InitCombo();
            }
        }

        public void InitCombo()
        {
            DataTable listPhanHe = this.objMN.GetListPhanHe("");
            this.CboPhanHe.DataSource = listPhanHe;
            this.CboPhanHe.ValueMember = "Ma";
            this.CboPhanHe.DisplayMember = "TenPhanHe";
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            this.Panel1 = new Panel();
            this.CKHienThiEngLish = new CheckBox();
            this.CKHienThiPhanHe = new CheckBox();
            this.Label1 = new Label();
            this.CboPhanHe = new ComboBox();
            this.VsList = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.CmdCopy = new Button();
            this.Panel1.SuspendLayout();
            this.VsList.BeginInit();
            this.SuspendLayout();
            this.Panel1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel1.Controls.Add(this.CmdCopy);
            this.Panel1.Controls.Add(this.CKHienThiEngLish);
            this.Panel1.Controls.Add(this.CKHienThiPhanHe);
            this.Panel1.Controls.Add(this.Label1);
            this.Panel1.Controls.Add(this.CboPhanHe);
            this.Panel1.Dock = DockStyle.Top;
            Point point = new Point(0, 0);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            Size size = new Size(0x37e, 0x2c);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0;
            this.CKHienThiEngLish.AutoSize = true;
            this.CKHienThiEngLish.BackColor = Color.Transparent;
            point = new Point(0x2a1, 0x11);
            this.CKHienThiEngLish.Location = point;
            this.CKHienThiEngLish.Name = "CKHienThiEngLish";
            size = new Size(0x72, 0x11);
            this.CKHienThiEngLish.Size = size;
            this.CKHienThiEngLish.TabIndex = 3;
            this.CKHienThiEngLish.Text = "Hiển thị Tiếng Anh";
            this.CKHienThiEngLish.UseVisualStyleBackColor = false;
            this.CKHienThiPhanHe.AutoSize = true;
            this.CKHienThiPhanHe.BackColor = Color.Transparent;
            point = new Point(0x11f, 0x13);
            this.CKHienThiPhanHe.Location = point;
            this.CKHienThiPhanHe.Name = "CKHienThiPhanHe";
            size = new Size(0x74, 0x11);
            this.CKHienThiPhanHe.Size = size;
            this.CKHienThiPhanHe.TabIndex = 2;
            this.CKHienThiPhanHe.Text = "Được ph\x00e9p hiển thị";
            this.CKHienThiPhanHe.UseVisualStyleBackColor = false;
            this.Label1.AutoSize = true;
            this.Label1.BackColor = Color.Transparent;
            point = new Point(12, 0x10);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(0x2f, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 1;
            this.Label1.Text = "Ph\x00e2n hệ";
            this.CboPhanHe.FormattingEnabled = true;
            point = new Point(0x49, 13);
            this.CboPhanHe.Location = point;
            this.CboPhanHe.Name = "CboPhanHe";
            size = new Size(0xcd, 0x15);
            this.CboPhanHe.Size = size;
            this.CboPhanHe.TabIndex = 0;
            this.VsList.ColumnInfo = "10,0,0,0,0,85,Columns:";
            this.VsList.Dock = DockStyle.Fill;
            this.VsList.ExtendLastCol = true;
            point = new Point(0, 0x2c);
            this.VsList.Location = point;
            this.VsList.Name = "VsList";
            this.VsList.Rows.Count = 1;
            this.VsList.Rows.DefaultSize = 0x11;
            this.VsList.Rows.MaxSize = 20;
            this.VsList.Rows.MinSize = 20;
            size = new Size(0x37e, 0x20d);
            this.VsList.Size = size;
            this.VsList.TabIndex = 1;
            this.VsList.VisualStyle = VisualStyle.Office2007Blue;
            point = new Point(0x31c, 13);
            this.CmdCopy.Location = point;
            this.CmdCopy.Name = "CmdCopy";
            size = new Size(0x59, 0x1a);
            this.CmdCopy.Size = size;
            this.CmdCopy.TabIndex = 4;
            this.CmdCopy.Text = "Copy";
            this.CmdCopy.UseVisualStyleBackColor = true;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x37e, 0x239);
            this.ClientSize = size;
            this.Controls.Add(this.VsList);
            this.Controls.Add(this.Panel1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.MinimizeBox = false;
            this.Name = "Frm_HienThiChucNang";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "TUY CHON HIEN THI CHUC NANG";
            this.Panel1.ResumeLayout(false);
            this.Panel1.PerformLayout();
            this.VsList.EndInit();
            this.ResumeLayout(false);
        }

        public void LoadData(string pPhanHe)
        {
            DataTable allMenu = this.objMN.GetAllMenu(pPhanHe);
            C1.Win.C1FlexGrid.C1FlexGrid vsList = this.VsList;
            vsList.DataSource = allMenu;
            vsList.Cols[0].Width = 110;
            vsList.Cols[0].Caption = "Key";
            vsList.Cols[1].Width = 250;
            vsList.Cols[1].Caption = "Name (Vietnamese)";
            vsList.Cols[2].Width = 150;
            vsList.Cols[2].Caption = "Name (English)";
            vsList.Cols[2].Visible = false;
            vsList.Cols[3].Width = 70;
            vsList.Cols[3].Caption = "Image";
            vsList.Cols[4].Width = 70;
            vsList.Cols[4].Caption = "Group";
            vsList.Cols[5].Width = 70;
            vsList.Cols[5].Caption = "Type";
            vsList.Cols[6].Width = 70;
            vsList.Cols[6].Caption = "Order";
            vsList.Cols[7].Width = 60;
            vsList.Cols[7].Caption = "Module";
            vsList.Cols[8].Width = 60;
            vsList.Cols[8].Caption = "System";
            vsList.Cols[9].Width = 60;
            vsList.Cols[9].Caption = "Display";
            vsList.Cols[9].DataType = System.Type.GetType("System.Boolean");
            vsList.Cols[10].Width = 60;
            vsList.Cols[10].Caption = "Is group";
            vsList.Cols[10].DataType = System.Type.GetType("System.Boolean");
            vsList = null;
        }

        private void VsList_AfterEdit(object sender, RowColEventArgs e)
        {
            try
            {
                clsMenu objMN = this.objMN;
                objMN.Khoa = Conversions.ToString(this.VsList[e.Row, 0]);
                objMN.TenViet = Conversions.ToString(this.VsList[e.Row, 1]);
                objMN.TenAnh = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VsList[e.Row, 2]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
                objMN.ImageIndex = Conversions.ToInteger(this.VsList[e.Row, 3]);
                objMN.Nhom = Conversions.ToString(this.VsList[e.Row, 4]);
                objMN.ThuocTinh = Conversions.ToString(this.VsList[e.Row, 5]);
                objMN.MenuOrder = Conversions.ToString(this.VsList[e.Row, 6]);
                objMN.PhanHe = Conversions.ToString(this.VsList[e.Row, 7]);
                objMN.HeThong = Conversions.ToString(this.VsList[e.Row, 8]);
                objMN.HienThi = Conversions.ToInteger(this.VsList[e.Row, 9]);
                objMN.NhomMenu = Conversions.ToInteger(this.VsList[e.Row, 10]);
                objMN.Save();
                objMN = null;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                ProjectData.ClearProjectError();
            }
        }

        internal virtual ComboBox CboPhanHe
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboPhanHe;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CboPhanHe_SelectedIndexChanged);
                if (this._CboPhanHe != null)
                {
                    this._CboPhanHe.SelectedIndexChanged -= handler;
                }
                this._CboPhanHe = value;
                if (this._CboPhanHe != null)
                {
                    this._CboPhanHe.SelectedIndexChanged += handler;
                }
            }
        }

        internal virtual CheckBox CKHienThiEngLish
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CKHienThiEngLish;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CKHienThiEngLish_CheckedChanged);
                if (this._CKHienThiEngLish != null)
                {
                    this._CKHienThiEngLish.CheckedChanged -= handler;
                }
                this._CKHienThiEngLish = value;
                if (this._CKHienThiEngLish != null)
                {
                    this._CKHienThiEngLish.CheckedChanged += handler;
                }
            }
        }

        internal virtual CheckBox CKHienThiPhanHe
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CKHienThiPhanHe;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CKHienThiPhanHe = value;
            }
        }

        internal virtual Button CmdCopy
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdCopy;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdCopy_Click);
                if (this._CmdCopy != null)
                {
                    this._CmdCopy.Click -= handler;
                }
                this._CmdCopy = value;
                if (this._CmdCopy != null)
                {
                    this._CmdCopy.Click += handler;
                }
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VsList
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VsList;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                RowColEventHandler handler = new RowColEventHandler(this.VsList_AfterEdit);
                if (this._VsList != null)
                {
                    this._VsList.AfterEdit -= handler;
                }
                this._VsList = value;
                if (this._VsList != null)
                {
                    this._VsList.AfterEdit += handler;
                }
            }
        }
    }
}

